/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package demo1014;

import demo1012.*;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;

/**
 *
 * @author Administrator
 */
public class FileWriterDemo2 {
    
    public static void main(String args[]) {
        try {
            FileWriter fw = new FileWriter("e:/data4.txt");
            int x = 0;
            for (int i = 1; i <= 100; i++) {
                x = (int) (Math.random() * 100) + 101;
                fw.write(x + "");
                if (i % 10 == 0) {
                    fw.write("\r\n");
                } else {
                    fw.write(",");                    
                }
            }
            fw.close();
            
        } catch (FileNotFoundException e) {
            System.out.println("file not found");
            
            
        } catch (IOException e) {
            System.out.println("io error");
        }
        
    }
}
